import { createRouter, createWebHistory } from 'vue-router'
import BasicLayout from '../layouts/BasicLayout.vue'
import Home from '../views/HomeView.vue'
import ArticleDetail from '../views/ArticleDetail.vue'
import EssayView from '../views/EssayView.vue'
import MessageBoard from '../views/MessageBoard.vue'
import LoginView from '../views/LoginView.vue'

const routes = [
  {
    path: '/',
    component: BasicLayout,
    children: [
      {
        path: '',
        name: 'Home',
        component: Home
      },
      {
        path: 'article/:id',
        name: 'ArticleDetail',
        component: ArticleDetail
      },
      {
        path: 'essays',
        name: 'Essays',
        component: EssayView
      },
      {
        path: 'essays/:type',
        name: 'EssaysByType',
        component: EssayView
      },
      {
        path: 'messages',
        name: 'Messages',
        component: MessageBoard
      },
      {
        path: 'login',
        name: 'Login',
        component: LoginView
      }
    ]
  },

]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
